home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / include / linux / pmic_light.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-09  |  31.8 KB  |  1,083 lines

  1. /*
  2.  * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
  3.  */
  4.  
  5. /*
  6.  * The code contained herein is licensed under the GNU Lesser General
  7.  * Public License.  You may obtain a copy of the GNU Lesser General
  8.  * Public License Version 2.1 or later at the following locations:
  9.  *
  10.  * http://www.opensource.org/licenses/lgpl-license.html
  11.  * http://www.gnu.org/copyleft/lgpl.html
  12.  */
  13. #ifndef __ASM_ARCH_MXC_PMIC_LIGHT_H__
  14. #define __ASM_ARCH_MXC_PMIC_LIGHT_H__
  15.  
  16. /*!
  17.  * @defgroup PMIC_LIGHT PMIC Light Driver
  18.  * @ingroup PMIC_DRVRS
  19.  */
  20.  
  21. /*!
  22.  * @file arch-mxc/pmic_light.h
  23.  * @brief This is the header of PMIC Light driver.
  24.  *
  25.  * @ingroup PMIC_LIGHT
  26.  */
  27.  
  28. #include <linux/ioctl.h>
  29. #include <linux/pmic_status.h>
  30. #include <linux/pmic_external.h>
  31.  
  32. /*!
  33.  * @name IOCTL user space interface
  34.  */
  35.  
  36. /*! @{ */
  37. /*!
  38.  * Enable Backlight.
  39.  * Argument type: none.
  40.  */
  41. #define PMIC_BKLIT_ENABLE                   _IO('p', 0xe0)
  42. /*!
  43.  * Disable Backlight.
  44.  * Argument type: none.
  45.  */
  46. #define PMIC_BKLIT_DISABLE                  _IO('p', 0xe1)
  47. /*!
  48.  * Set backlight configuration.
  49.  * Argument type: pointer to t_bklit_setting_param
  50.  */
  51. #define PMIC_SET_BKLIT                      _IOW('p', 0xe2, int)
  52. /*!
  53.  * Get backlight configuration.
  54.  * Argument type: pointer to t_bklit_setting_param
  55.  */
  56. #define PMIC_GET_BKLIT                      _IOWR('p', 0xe3, int)
  57. /*!
  58.  * Ramp up configuration.
  59.  * Argument type: t_bklit_channel
  60.  */
  61. #define PMIC_RAMPUP_BKLIT                   _IOW('p', 0xe4, int)
  62. /*!
  63.  * Ramp down configuration.
  64.  * Argument type: t_bklit_channel
  65.  */
  66. #define PMIC_RAMPDOWN_BKLIT                 _IOW('p', 0xe5, int)
  67. /*!
  68.  * Enable Tri-color LED.
  69.  * Argument type: t_tcled_enable_param
  70.  */
  71. #define PMIC_TCLED_ENABLE                   _IOW('p', 0xe6, int)
  72. /*!
  73.  * Disable Tri-color LED.
  74.  * Argument type: t_funlight_bank
  75.  */
  76. #define PMIC_TCLED_DISABLE                  _IOW('p', 0xe7, int)
  77. /*!
  78.  * Start Tri-color LED pattern.
  79.  * Argument type: t_fun_param
  80.  */
  81. #define PMIC_TCLED_PATTERN                  _IOW('p', 0xe8, int)
  82. /*!
  83.  * Enable Backlight & tcled.
  84.  * Argument type: none.
  85.  */
  86. #define PMIC_BKLIT_TCLED_ENABLE             _IO('p', 0xe9)
  87. /*!
  88.  * Disable Backlight & tcled.
  89.  * Argument type: none.
  90.  */
  91. #define PMIC_BKLIT_TCLED_DISABLE            _IO('p', 0xea)
  92. /*!
  93.  * Reset ramp up configuration.
  94.  * Argument type: t_bklit_channel
  95.  */
  96. #define PMIC_OFF_RAMPUP_BKLIT               _IOW('p', 0xeb, int)
  97. /*!
  98.  * Reset ramp down configuration.
  99.  * Argument type: t_bklit_channel
  100.  */
  101. #define PMIC_OFF_RAMPDOWN_BKLIT             _IOW('p', 0xec, int)
  102. /*!
  103.  * Set tcled ind configuration.
  104.  * Argument type: t_tcled_ind_param
  105.  */
  106. #define PMIC_SET_TCLED                _IOW('p', 0xed, int)
  107. /*!
  108.  * Get tcled ind configuration.
  109.  * Argument type: t_tcled_ind_param
  110.  */
  111. #define PMIC_GET_TCLED                _IOWR('p', 0xee, int)
  112. /*! @} */
  113. /*!
  114.  * @enum t_bklit_mode
  115.  * @brief Backlight modes.
  116.  */
  117. typedef enum {
  118.     BACKLIGHT_CURRENT_CTRL_MODE,    /*! < Current control mode */
  119.     BACKLIGHT_TRIODE_MODE    /*! < Triode mode */
  120. } t_bklit_mode;
  121.  
  122. /*!
  123.  * @enum t_bklit_channel
  124.  * @brief Backlight channels.
  125.  */
  126. typedef enum {
  127.     BACKLIGHT_LED1,        /*! < Backlight channel 1 */
  128.     BACKLIGHT_LED2,        /*! < Backlight channel 2 */
  129.     BACKLIGHT_LED3        /*! < Backlight channel 3 */
  130. } t_bklit_channel;
  131.  
  132. /*!
  133.  * @enum t_bklit_strobe_mode
  134.  * @brief Backlight Strobe Light Pulsing modes.
  135.  */
  136. typedef enum {
  137.     /*!
  138.      * No Strobe Light Pulsing
  139.      */
  140.     BACKLIGHT_STROBE_NONE,
  141.     /*!
  142.      * Strobe Light Pulsing at 3.3% duty cycle over 300msec (Driver goes
  143.      * into Triode Mode with pulses constrained to 10msec.)
  144.      */
  145.     BACKLIGHT_STROBE_FAST,
  146.     /*!
  147.      * Strobe Light Pulsing at 10% duty cycle over 100msec (Driver goes
  148.      * into Triode Mode with pulses constrained to 10msec.)
  149.      */
  150.     BACKLIGHT_STROBE_SLOW
  151. } t_bklit_strobe_mode;
  152.  
  153. /*!
  154.  * @struct t_bklit_setting_param
  155.  * @brief Backlight setting.
  156.  */
  157.  
  158. typedef struct {
  159.     t_bklit_channel channel;    /*!< Channel */
  160.     t_bklit_mode mode;    /*!< Mode */
  161.     t_bklit_strobe_mode strobe;    /*!< Strobe mode */
  162.     unsigned char current_level;    /*!< Current level */
  163.     unsigned char duty_cycle;    /*!< Duty cycle */
  164.     unsigned char cycle_time;    /*!< Cycle time */
  165.     bool edge_slow;        /*!< Edge Slow */
  166.     bool en_dis;        /*!< Enable disable boost mode */
  167.     unsigned int abms;    /*!< Adaptive boost
  168.                  *   mode selection */
  169.     unsigned int abr;    /*!< Adaptive
  170.                  *   boost reference */
  171. } t_bklit_setting_param;
  172.  
  173. /*!
  174.  * @enum t_funlight_bank
  175.  * @brief Tri-color LED fun light banks.
  176.  */
  177. typedef enum {
  178.     TCLED_FUN_BANK1 = 0,    /*! < Fun light bank 1 */
  179.     TCLED_FUN_BANK2,    /*! < Fun light bank 2 */
  180.     TCLED_FUN_BANK3        /*! < Fun light bank 3 */
  181. } t_funlight_bank;
  182.  
  183. /*!
  184.  * @enum t_tcled_mode
  185.  * @brief Tri-color LED operation modes.
  186.  *
  187.  * The Tri-Color LED Driver circuitry includes 2 modes of operation. In LED
  188.  * Indicator Mode, this circuitry operates as Red and Green LED Drivers with
  189.  * flasher timing to indicate GSM network status. In Fun Light Mode, this
  190.  * circuitry provides expanded capability for current control and distribution
  191.  * that supplements the three channels.
  192.  */
  193. typedef enum {
  194.     TCLED_IND_MODE = 0,    /*! < LED Indicator Mode */
  195.     TCLED_FUN_MODE        /*! < Fun Light Mode */
  196. } t_tcled_mode;
  197.  
  198. /*!
  199.  * @struct t_tcled_enable_param
  200.  * @brief enable setting.
  201.  */
  202. typedef struct {
  203.     t_funlight_bank bank;    /*!< Bank */
  204.     t_tcled_mode mode;    /*!< Mode */
  205. } t_tcled_enable_param;
  206.  
  207. /*!
  208.  * @enum t_ind_channel
  209.  * @brief Tri-color LED indicator mode channels.
  210.  *
  211.  */
  212.  
  213. typedef enum {
  214.     TCLED_IND_RED = 0,    /*! < Red LED */
  215.     TCLED_IND_GREEN,    /*! < Green LED */
  216.     TCLED_IND_BLUE        /*! < Blue LED */
  217. } t_ind_channel;
  218.  
  219. /*!
  220.  * @enum t_funlight_channel
  221.  * @brief Tri-color LED fun light mode channels.
  222.  *
  223.  */
  224. typedef enum {
  225.     TCLED_FUN_CHANNEL1 = 0,    /*! < Fun light channel 1 (Red) */
  226.     TCLED_FUN_CHANNEL2,    /*! < Fun light channel 2 (Green) */
  227.     TCLED_FUN_CHANNEL3    /*! < Fun light channel 3 (Blue) */
  228. } t_funlight_channel;
  229.  
  230. /*!
  231.  * @enum t_tcled_ind_blink_pattern
  232.  * @brief Tri-color LED Indicator Mode blinking mode.
  233.  */
  234. typedef enum {
  235.     TCLED_IND_OFF = 0,    /*! < Continuous off */
  236.     TCLED_IND_BLINK_1,    /*! < 1 / 31 */
  237.     TCLED_IND_BLINK_2,    /*! < 2 / 31 */
  238.     TCLED_IND_BLINK_3,    /*! < 3 / 31  */
  239.     TCLED_IND_BLINK_4,    /*! < 4 / 31  */
  240.     TCLED_IND_BLINK_5,    /*! < 5 / 31  */
  241.     TCLED_IND_BLINK_6,    /*! < 6 / 31  */
  242.     TCLED_IND_BLINK_7,    /*! < 7 / 31  */
  243.     TCLED_IND_BLINK_8,    /*! < 8 / 31  */
  244.     TCLED_IND_BLINK_9,    /*! < 9 / 31  */
  245.     TCLED_IND_BLINK_10,    /*! < 10 / 31  */
  246.     TCLED_IND_BLINK_11,    /*! < 11 / 31  */
  247.     TCLED_IND_BLINK_12,    /*! < 12 / 31  */
  248.     TCLED_IND_BLINK_13,    /*! < 13 / 31  */
  249.     TCLED_IND_BLINK_14,    /*! < 14 / 31  */
  250.     TCLED_IND_BLINK_15,    /*! < 15 / 31  */
  251.     TCLED_IND_BLINK_16,    /*! < 16 / 31  */
  252.     TCLED_IND_BLINK_17,    /*! < 17 / 31  */
  253.     TCLED_IND_BLINK_18,    /*! < 18 / 31  */
  254.     TCLED_IND_BLINK_19,    /*! < 19 / 31  */
  255.     TCLED_IND_BLINK_20,    /*! < 20 / 31  */
  256.     TCLED_IND_BLINK_21,    /*! < 21 / 31  */
  257.     TCLED_IND_BLINK_22,    /*! < 22 / 31  */
  258.     TCLED_IND_BLINK_23,    /*! < 23 / 31  */
  259.     TCLED_IND_BLINK_24,    /*! < 24 / 31  */
  260.     TCLED_IND_BLINK_25,    /*! < 25 / 31  */
  261.     TCLED_IND_BLINK_26,    /*! < 26 / 31  */
  262.     TCLED_IND_BLINK_27,    /*! < 27 / 31  */
  263.     TCLED_IND_BLINK_28,    /*! < 28 / 31  */
  264.     TCLED_IND_BLINK_29,    /*! < 29 / 31  */
  265.     TCLED_IND_BLINK_30,    /*! < 30 / 31  */
  266.     TCLED_IND_ON        /*! < Continuous on */
  267. } t_tcled_ind_blink_pattern;
  268.  
  269. /*!
  270.  * @enum t_tcled_cur_level
  271.  * @brief Tri-color LED current levels.
  272.  */
  273. typedef enum {
  274.     TCLED_CUR_LEVEL_1 = 0,    /*! < Tri-Color LED current level 1 */
  275.     TCLED_CUR_LEVEL_2,    /*! < Tri-Color LED current level 2 */
  276.     TCLED_CUR_LEVEL_3,    /*! < Tri-Color LED current level 3 */
  277.     TCLED_CUR_LEVEL_4    /*! < Tri-Color LED current level 4 */
  278. } t_tcled_cur_level;
  279.  
  280. /*!
  281.  * @enum t_tcled_fun_cycle_time
  282.  * @brief Tri-color LED fun light mode cycle time.
  283.  */
  284. typedef enum {
  285.     TC_CYCLE_TIME_1 = 0,    /*! < Tri-Color LED cycle time 1 */
  286.     TC_CYCLE_TIME_2,    /*! < Tri-Color LED cycle time 2 */
  287.     TC_CYCLE_TIME_3,    /*! < Tri-Color LED cycle time 3 */
  288.     TC_CYCLE_TIME_4        /*! < Tri-Color LED cycle time 4 */
  289. } t_tcled_fun_cycle_time;
  290.  
  291. /*!
  292.  * @enum t_tcled_fun_speed
  293.  * @brief Tri-color LED fun light mode pattern speed.
  294.  */
  295. typedef enum {
  296.     TC_OFF = 0,        /*! < Tri-Color pattern off */
  297.     TC_SLOW,        /*! < Tri-Color slow pattern */
  298.     TC_FAST            /*! < Tri-Color fast pattern */
  299. } t_tcled_fun_speed;
  300.  
  301. /*!
  302.  * @enum t_tcled_fun_speed
  303.  * @brief Tri-color LED fun light mode pattern speed.
  304.  */
  305. typedef enum {
  306.     TC_STROBE_OFF = 0,    /*! < No strobe */
  307.     TC_STROBE_SLOW,        /*! < Slow strobe pattern */
  308.     TC_STROBE_FAST        /*! < fast strobe pattern */
  309. } t_tcled_fun_strobe_speed;
  310.  
  311. /*!
  312.  * @enum t_chaselight_pattern
  313.  * @brief Tri-color LED fun light mode chasing light patterns.
  314.  */
  315. typedef enum {
  316.     PMIC_RGB = 0,        /*!< R -> G -> B */
  317.     BGR            /*!< B -> G -> R */
  318. } t_chaselight_pattern;
  319.  
  320. /*!
  321.  * This enumeration of Fun Light Pattern.
  322.  */
  323. typedef enum {
  324.     /*!
  325.      * Blended ramps slow
  326.      */
  327.     BLENDED_RAMPS_SLOW,
  328.     /*!
  329.      * Blended ramps fast
  330.      */
  331.     BLENDED_RAMPS_FAST,
  332.     /*!
  333.      * Saw ramps slow
  334.      */
  335.     SAW_RAMPS_SLOW,
  336.     /*!
  337.      * Saw ramps fast
  338.      */
  339.     SAW_RAMPS_FAST,
  340.     /*!
  341.      * Blended bowtie slow
  342.      */
  343.     BLENDED_BOWTIE_SLOW,
  344.     /*!
  345.      * Blended bowtie fast
  346.      */
  347.     BLENDED_BOWTIE_FAST,
  348.     /*!
  349.      * Strobe slow
  350.      */
  351.     STROBE_SLOW,
  352.     /*!
  353.      * Strobe fast
  354.      */
  355.     STROBE_FAST,
  356.     /*!
  357.      * Chasing Light RGB Slow
  358.      */
  359.     CHASING_LIGHT_RGB_SLOW,
  360.     /*!
  361.      * Chasing Light RGB fast
  362.      */
  363.     CHASING_LIGHT_RGB_FAST,
  364.     /*!
  365.      * Chasing Light BGR Slow
  366.      */
  367.     CHASING_LIGHT_BGR_SLOW,
  368.     /*!
  369.      * Chasing Light BGR fast
  370.      */
  371.     CHASING_LIGHT_BGR_FAST,
  372. } t_fun_pattern;
  373.  
  374. /*!
  375.  * @struct t_fun_param
  376.  * @brief LED fun pattern IOCTL parameter
  377.  */
  378. typedef struct {
  379.     t_funlight_bank bank;    /*!< TCLED bank */
  380.     t_funlight_channel channel;    /*!< TCLED channel */
  381.     t_fun_pattern pattern;    /*!< Fun pattern */
  382. } t_fun_param;
  383.  
  384. /*!
  385.  * @enum t_led_channel
  386.  * @brief LED channels including backlight and tri-color LEDs.
  387.  */
  388. typedef enum {
  389.     AUDIO_LED1,        /*! < Backlight channel 1 */
  390.     AUDIO_LED2,        /*! < Backlight channel 2 */
  391.     AUDIO_LEDR,        /*! < Fun light channel 1 (Red) */
  392.     AUDIO_LEDG,        /*! < Fun light channel 2 (Green) */
  393.     AUDIO_LEDB        /*! < Fun light channel 3 (Blue) */
  394. } t_led_channel;
  395.  
  396. /*!
  397.  * @enum t_aud_path
  398.  * @brief LED audio modulation in-out audio channels
  399.  */
  400. typedef enum {
  401.     MIXED_RX = 0,        /*!<  Mixed L & R Channel RX audio */
  402.     TX            /*!<  TX path */
  403. } t_aud_path;
  404.  
  405. /*!
  406.  * @enum t_aud_gain
  407.  * @brief LED audio modulation in-out audio channels
  408.  */
  409. typedef enum {
  410.     GAIN_MINUS6DB = 0,    /*!< -6 dB */
  411.     GAIN_0DB,        /*!< 0 dB */
  412.     GAIN_6DB,        /*!< 6 dB */
  413.     GAIN_12DB        /*!< 12 dB */
  414. } t_aud_gain;
  415.  
  416. /*!
  417.  * @struct t_tcled_ind_param
  418.  * @brief LED parameter
  419.  */
  420. typedef struct {
  421.     t_funlight_bank bank;    /*! < tcled bank */
  422.     t_ind_channel channel;    /*! < tcled channel */
  423.     t_tcled_cur_level level;    /*! < tcled current level */
  424.     t_tcled_ind_blink_pattern pattern;    /*! < tcled dutty cycle */
  425.     bool skip;        /*! < tcled skip */
  426.     bool rampup;        /*! < tcled rampup */
  427.     bool rampdown;        /*! < tcled rampdown */
  428.     bool half_current;    /*! < tcled half current */
  429. } t_tcled_ind_param;
  430.  
  431. #if defined(CONFIG_MXC_PMIC_MC13892)
  432.  
  433. enum curr_level {
  434.     LIT_CURR_0 = 0,
  435.     LIT_CURR_3,
  436.     LIT_CURR_6,
  437.     LIT_CURR_9,
  438.     LIT_CURR_12,
  439.     LIT_CURR_15,
  440.     LIT_CURR_18,
  441.     LIT_CURR_21,
  442.     /* below setting only used for main/aux/keypad */
  443.     LIT_CURR_HI_0,
  444.     LIT_CURR_HI_6,
  445.     LIT_CURR_HI_12,
  446.     LIT_CURR_HI_18,
  447.     LIT_CURR_HI_24,
  448.     LIT_CURR_HI_30,
  449.     LIT_CURR_HI_36,
  450.     LIT_CURR_HI_42,
  451. };
  452.  
  453. enum lit_channel {
  454.     LIT_MAIN = 0,
  455.     LIT_AUX,
  456.     LIT_KEY,
  457.     LIT_RED,
  458.     LIT_GREEN,
  459.     LIT_BLUE,
  460. };
  461.  
  462. #endif
  463.  
  464. /* EXPORTED FUNCTIONS */
  465. #ifdef __KERNEL__
  466. /*!
  467.  * This function enables backlight & tcled.
  468.  *
  469.  * @return       This function returns PMIC_SUCCESS if successful.
  470.  */
  471. PMIC_STATUS pmic_bklit_tcled_master_enable(void);
  472.  
  473. /*!
  474.  * This function disables backlight & tcled.
  475.  *
  476.  * @return       This function returns PMIC_SUCCESS if successful
  477.  */
  478. PMIC_STATUS pmic_bklit_tcled_master_disable(void);
  479.  
  480. /*!
  481.  * This function enables backlight.
  482.  *
  483.  * @return       This function returns PMIC_SUCCESS if successful.
  484.  */
  485. PMIC_STATUS pmic_bklit_master_enable(void);
  486.  
  487. /*!
  488.  * This function disables backlight.
  489.  *
  490.  * @return       This function returns PMIC_SUCCESS if successful.
  491.  */
  492. PMIC_STATUS pmic_bklit_master_disable(void);
  493.  
  494. /*!
  495.  * This function sets backlight current level.
  496.  *
  497.  * @param        channel   Backlight channel
  498.  * @param        level     Backlight current level, as the following table.
  499.  *                         @verbatim
  500.                                level     current
  501.                                ------    -----------
  502.                                  0         0 mA
  503.                                  1         12 mA
  504.                                  2         24 mA
  505.                                  3         36 mA
  506.                                  4         48 mA
  507.                                  5         60 mA
  508.                                  6         72 mA
  509.                                  7         84 mA
  510.                             @endverbatim
  511.  * @return       This function returns PMIC_SUCCESS if successful.
  512.  */
  513. PMIC_STATUS pmic_bklit_set_current(t_bklit_channel channel,
  514.                    unsigned char level);
  515.  
  516. /*!
  517.  * This function retrives backlight current level.
  518.  *
  519.  * @param        channel   Backlight channel
  520.  * @param        level     Pointer to store backlight current level result.
  521.  *
  522.  * @return       This function returns PMIC_SUCCESS if successful.
  523.  */
  524. PMIC_STATUS pmic_bklit_get_current(t_bklit_channel channel,
  525.                    unsigned char *level);
  526.  
  527. /*!
  528.  * This function sets a backlight channel duty cycle.
  529.  * LED perceived brightness for each zone may be individually set by setting
  530.  * duty cycle. The default setting is for 0% duty cycle; this keeps all zone
  531.  * drivers turned off even after the master enable command. Each LED current
  532.  * sink can be turned on and adjusted for brightness with an independent 4 bit
  533.  * word for a duty cycle ranging from 0% to 100% in approximately 6.7% steps.
  534.  *
  535.  * @param        channel   Backlight channel.
  536.  * @param        dc        Backlight duty cycle, as the following table.
  537.  *                         @verbatim
  538.                                 dc        Duty Cycle (% On-time over Cycle Time)
  539.                                ------    ---------------------------------------
  540.                                   0        0%
  541.                                   1        6.7%
  542.                                   2        13.3%
  543.                                   3        20%
  544.                                   4        26.7%
  545.                                   5        33.3%
  546.                                   6        40%
  547.                                   7        46.7%
  548.                                   8        53.3%
  549.                                   9        60%
  550.                                  10        66.7%
  551.                                  11        73.3%
  552.                                  12        80%
  553.                                  13        86.7%
  554.                                  14        93.3%
  555.                                  15        100%
  556.                              @endverbatim
  557.  * @return       This function returns PMIC_SUCCESS if successful.
  558.  */
  559. PMIC_STATUS pmic_bklit_set_dutycycle(t_bklit_channel channel, unsigned char dc);
  560.  
  561. /*!
  562.  * This function retrives a backlight channel duty cycle.
  563.  *
  564.  * @param        channel   Backlight channel.
  565.  * @param        cycle     Pointer to backlight duty cycle.
  566.  *
  567.  * @return       This function returns PMIC_SUCCESS if successful.
  568.  */
  569. PMIC_STATUS pmic_bklit_get_dutycycle(t_bklit_channel channel,
  570.                      unsigned char *dc);
  571.  
  572. /*!
  573.  * This function sets a backlight channel cycle time.
  574.  * Cycle Time is defined as the period of a complete cycle of
  575.  * Time_on + Time_off. The default Cycle Time is set to 0.01 seconds such that
  576.  * the 100 Hz on-off cycling is averaged out by the eye to eliminate
  577.  * flickering. Additionally, the Cycle Time can be programmed to intentionally
  578.  * extend the period of on-off cycles for a visual pulsating or blinking effect.
  579.  *
  580.  * @param        period    Backlight cycle time, as the following table.
  581.  *                         @verbatim
  582.                                 period      Cycle Time
  583.                                --------    ------------
  584.                                   0          0.01 seconds
  585.                                   1          0.1 seconds
  586.                                   2          0.5 seconds
  587.                                   3          2 seconds
  588.                              @endverbatim
  589.  * @return       This function returns PMIC_SUCCESS if successful.
  590.  */
  591. PMIC_STATUS pmic_bklit_set_cycle_time(unsigned char period);
  592.  
  593. /*!
  594.  * This function retrives a backlight channel cycle time setting.
  595.  *
  596.  * @param        period    Pointer to save backlight cycle time setting result.
  597.  *
  598.  * @return       This function returns PMIC_SUCCESS if successful.
  599.  */
  600. PMIC_STATUS pmic_bklit_get_cycle_time(unsigned char *period);
  601.  
  602. /*!
  603.  * This function sets backlight operation mode. There are two modes of
  604.  * operations: current control and triode mode.
  605.  * The Duty Cycle/Cycle Time control is retained in Triode Mode. Audio
  606.  * coupling is not available in Triode Mode.
  607.  *
  608.  * @param        channel   Backlight channel.
  609.  * @param        mode      Backlight operation mode.
  610.  *
  611.  * @return       This function returns PMIC_SUCCESS if successful.
  612.  */
  613. PMIC_STATUS pmic_bklit_set_mode(t_bklit_channel channel, t_bklit_mode mode);
  614. /*!
  615.  * This function gets backlight operation mode. There are two modes of
  616.  * operations: current control and triode mode.
  617.  * The Duty Cycle/Cycle Time control is retained in Triode Mode. Audio
  618.  * coupling is not available in Triode Mode.
  619.  *
  620.  * @param        channel   Backlight channel.
  621.  * @param        mode      Backlight operation mode.
  622.  *
  623.  * @return       This function returns PMIC_SUCCESS if successful.
  624.  */
  625. PMIC_STATUS pmic_bklit_get_mode(t_bklit_channel channel, t_bklit_mode * mode);
  626. /*!
  627.  * This function starts backlight brightness ramp up function; ramp time is
  628.  * fixed at 0.5 seconds.
  629.  *
  630.  * @param        channel   Backlight channel.
  631.  *
  632.  * @return       This function returns PMIC_SUCCESS if successful.
  633.  */
  634. PMIC_STATUS pmic_bklit_rampup(t_bklit_channel channel);
  635. /*!
  636.  * This function stops backlight brightness ramp up function;
  637.  *
  638.  * @param        channel   Backlight channel.
  639.  *
  640.  * @return       This function returns PMIC_SUCCESS if successful.
  641.  */
  642. PMIC_STATUS pmic_bklit_off_rampup(t_bklit_channel channel);
  643. /*!
  644.  * This function starts backlight brightness ramp down function; ramp time is
  645.  * fixed at 0.5 seconds.
  646.  *
  647.  * @param        channel   Backlight channel.
  648.  *
  649.  * @return       This function returns PMIC_SUCCESS if successful.
  650.  */
  651. PMIC_STATUS pmic_bklit_rampdown(t_bklit_channel channel);
  652. /*!
  653.  * This function stops backlight brightness ramp down function.
  654.  *
  655.  * @param        channel   Backlight channel.
  656.  *
  657.  * @return       This function returns PMIC_SUCCESS if successful.
  658.  */
  659. PMIC_STATUS pmic_bklit_off_rampdown(t_bklit_channel channel);
  660. /*!
  661.  * This function enables backlight analog edge slowing mode. Analog Edge
  662.  * Slowing slows down the transient edges to reduce the chance of coupling LED
  663.  * modulation activity into other circuits. Rise and fall times will be targeted
  664.  * for approximately 50usec.
  665.  *
  666.  * @return       This function returns PMIC_SUCCESS if successful.
  667.  */
  668. PMIC_STATUS pmic_bklit_enable_edge_slow(void);
  669.  
  670. /*!
  671.  * This function disables backlight analog edge slowing mode. The backlight
  672.  * drivers will default to an ìInstant Onî mode.
  673.  *
  674.  * @return       This function returns PMIC_SUCCESS if successful.
  675.  */
  676. PMIC_STATUS pmic_bklit_disable_edge_slow(void);
  677. /*!
  678.  * This function gets backlight analog edge slowing mode. DThe backlight
  679.  *
  680.  * @param        edge      Edge slowing mode.
  681.  *
  682.  * @return       This function returns PMIC_SUCCESS if successful.
  683.  */
  684. PMIC_STATUS pmic_bklit_get_edge_slow(bool * edge);
  685. /*!
  686.  * This function sets backlight Strobe Light Pulsing mode.
  687.  *
  688.  * @param        channel   Backlight channel.
  689.  * @param        mode      Strobe Light Pulsing mode.
  690.  *
  691.  * @return       This function returns PMIC_SUCCESS if successful.
  692.  */
  693. PMIC_STATUS pmic_bklit_set_strobemode(t_bklit_channel channel,
  694.                       t_bklit_strobe_mode mode);
  695.  
  696. /*!
  697.  * This function enables tri-color LED.
  698.  *
  699.  * @param        mode      Tri-color LED operation mode.
  700.  *
  701.  * @return       This function returns PMIC_SUCCESS if successful.
  702.  */
  703. PMIC_STATUS pmic_tcled_enable(t_tcled_mode mode, t_funlight_bank bank);
  704. /*!
  705.  * This function disables tri-color LED.
  706.  *
  707.  * @return       This function returns PMIC_SUCCESS if successful.
  708.  */
  709. PMIC_STATUS pmic_tcled_disable(t_funlight_bank bank);
  710. /*!
  711.  * This function retrives tri-color LED operation mode.
  712.  *
  713.  * @param        mode      Pointer to Tri-color LED operation mode.
  714.  *
  715.  * @return       This function returns PMIC_SUCCESS if successful.
  716.  */
  717. PMIC_STATUS pmic_tcled_get_mode(t_tcled_mode * mode, t_funlight_bank bank);
  718. /*!
  719.  * This function sets a tri-color LED channel current level in indicator mode.
  720.  *
  721.  * @param        channel      Tri-color LED channel.
  722.  * @param        level        Current level.
  723.  *
  724.  * @return       This function returns PMIC_SUCCESS if successful.
  725.  */
  726. PMIC_STATUS pmic_tcled_ind_set_current(t_ind_channel channel,
  727.                        t_tcled_cur_level level,
  728.                        t_funlight_bank bank);
  729. /*!
  730.  * This function retrives a tri-color LED channel current level in indicator mode.
  731.  *
  732.  * @param        channel      Tri-color LED channel.
  733.  * @param        level        Pointer to current level.
  734.  *
  735.  * @return       This function returns PMIC_SUCCESS if successful.
  736.  */
  737. PMIC_STATUS pmic_tcled_ind_get_current(t_ind_channel channel,
  738.                        t_tcled_cur_level * level,
  739.                        t_funlight_bank bank);
  740. /*!
  741.  * This function sets a tri-color LED channel blinking pattern in indication
  742.  * mode.
  743.  *
  744.  * @param        channel      Tri-color LED channel.
  745.  * @param        pattern      Blinking pattern.
  746.  * @param        skip         If true, skip a cycle after each cycle.
  747.  *
  748.  * @return       This function returns PMIC_SUCCESS if successful.
  749.  */
  750.  
  751. PMIC_STATUS pmic_tcled_ind_set_blink_pattern(t_ind_channel channel,
  752.                          t_tcled_ind_blink_pattern pattern,
  753.                          bool skip, t_funlight_bank bank);
  754. /*!
  755.  * This function retrives a tri-color LED channel blinking pattern in
  756.  * indication mode.
  757.  *
  758.  * @param        channel      Tri-color LED channel.
  759.  * @param        pattern      Pointer to Blinking pattern.
  760.  * @param        skip         Pointer to a boolean variable indicating if skip
  761.  *                            a cycle after each cycle.
  762.  *
  763.  * @return       This function returns PMIC_SUCCESS if successful.
  764.  */
  765. PMIC_STATUS pmic_tcled_ind_get_blink_pattern(t_ind_channel channel,
  766.                          t_tcled_ind_blink_pattern *
  767.                          pattern, bool * skip,
  768.                          t_funlight_bank bank);
  769. /*!
  770.  * This function sets a tri-color LED channel current level in Fun Light mode.
  771.  *
  772.  * @param        bank         Tri-color LED bank
  773.  * @param        channel      Tri-color LED channel.
  774.  * @param        level        Current level.
  775.  *
  776.  * @return       This function returns PMIC_SUCCESS if successful.
  777.  */
  778. PMIC_STATUS pmic_tcled_fun_set_current(t_funlight_bank bank,
  779.                        t_funlight_channel channel,
  780.                        t_tcled_cur_level level);
  781.  
  782. /*!
  783.  * This function retrives a tri-color LED channel current level
  784.  * in Fun Light mode.
  785.  *
  786.  * @param        bank         Tri-color LED bank
  787.  * @param        channel      Tri-color LED channel.
  788.  * @param        level        Pointer to current level.
  789.  *
  790.  * @return       This function returns PMIC_SUCCESS if successful.
  791.  */
  792. PMIC_STATUS pmic_tcled_fun_get_current(t_funlight_bank bank,
  793.                        t_funlight_channel channel,
  794.                        t_tcled_cur_level * level);
  795.  
  796. /*!
  797.  * This function sets tri-color LED cycle time in Fun Light mode.
  798.  *
  799.  * @param        bank         Tri-color LED bank
  800.  * @param        ct           Cycle time.
  801.  *
  802.  * @return       This function returns PMIC_SUCCESS if successful.
  803.  */
  804. PMIC_STATUS pmic_tcled_fun_set_cycletime(t_funlight_bank bank,
  805.                      t_tcled_fun_cycle_time ct);
  806.  
  807. /*!
  808.  * This function retrives tri-color LED cycle time in Fun Light mode.
  809.  *
  810.  * @param        bank         Tri-color LED bank
  811.  * @param        ct           Pointer to cycle time.
  812.  *
  813.  * @return       This function returns PMIC_SUCCESS if successful.
  814.  */
  815. PMIC_STATUS pmic_tcled_fun_get_cycletime(t_funlight_bank bank,
  816.                      t_tcled_fun_cycle_time * ct);
  817.  
  818. /*!
  819.  * This function sets a tri-color LED channel duty cycle in Fun Light mode.
  820.  *
  821.  * @param        bank         Tri-color LED bank
  822.  * @param        channel      Tri-color LED channel.
  823.  * @param        dc           Duty cycle.
  824.  *
  825.  * @return       This function returns PMIC_SUCCESS if successful.
  826.  */
  827. PMIC_STATUS pmic_tcled_fun_set_dutycycle(t_funlight_bank bank,
  828.                      t_funlight_channel channel,
  829.                      unsigned char dc);
  830.  
  831. /*!
  832.  * This function retrives a tri-color LED channel duty cycle in Fun Light mode.
  833.  *
  834.  * @param        bank         Tri-color LED bank
  835.  * @param        channel      Tri-color LED channel.
  836.  * @param        dc           Pointer to duty cycle.
  837.  *
  838.  * @return       This function returns PMIC_SUCCESS if successful.
  839.  */
  840. PMIC_STATUS pmic_tcled_fun_get_dutycycle(t_funlight_bank bank,
  841.                      t_funlight_channel channel,
  842.                      unsigned char *dc);
  843.  
  844. /*!
  845.  * This function initiates Blended Ramp fun light pattern.
  846.  *
  847.  * @param        bank         Tri-color LED bank
  848.  * @param        speed        Speed of pattern.
  849.  *
  850.  * @return       This function returns PMIC_SUCCESS if successful.
  851.  */
  852. PMIC_STATUS pmic_tcled_fun_blendedramps(t_funlight_bank bank,
  853.                     t_tcled_fun_speed speed);
  854.  
  855. /*!
  856.  * This function initiates Saw Ramp fun light pattern.
  857.  *
  858.  * @param        bank         Tri-color LED bank
  859.  * @param        speed        Speed of pattern.
  860.  *
  861.  * @return       This function returns PMIC_SUCCESS if successful.
  862.  */
  863. PMIC_STATUS pmic_tcled_fun_sawramps(t_funlight_bank bank,
  864.                     t_tcled_fun_speed speed);
  865.  
  866. /*!
  867.  * This function initiates Blended Bowtie fun light pattern.
  868.  *
  869.  * @param        bank         Tri-color LED bank
  870.  * @param        speed        Speed of pattern.
  871.  *
  872.  * @return       This function returns PMIC_SUCCESS if successful.
  873.  */
  874. PMIC_STATUS pmic_tcled_fun_blendedbowtie(t_funlight_bank bank,
  875.                      t_tcled_fun_speed speed);
  876.  
  877. /*!
  878.  * This function initiates Chasing Lights fun light pattern.
  879.  *
  880.  * @param        bank         Tri-color LED bank
  881.  * @param        pattern      Chasing light pattern mode.
  882.  * @param        speed        Speed of pattern.
  883.  *
  884.  * @return       This function returns PMIC_SUCCESS if successful.
  885.  */
  886. PMIC_STATUS pmic_tcled_fun_chasinglightspattern(t_funlight_bank bank,
  887.                         t_chaselight_pattern pattern,
  888.                         t_tcled_fun_speed speed);
  889.  
  890. /*!
  891.  * This function initiates Strobe Mode fun light pattern.
  892.  *
  893.  * @param        bank         Tri-color LED bank
  894.  * @param        channel      Tri-color LED channel.
  895.  * @param        speed        Speed of pattern.
  896.  *
  897.  * @return       This function returns PMIC_SUCCESS if successful.
  898.  */
  899. PMIC_STATUS pmic_tcled_fun_strobe(t_funlight_bank bank,
  900.                   t_funlight_channel channel,
  901.                   t_tcled_fun_strobe_speed speed);
  902.  
  903. /*!
  904.  * This function initiates Tri-color LED brightness Ramp Up function; Ramp time
  905.  * is fixed at 1 second.
  906.  *
  907.  * @param        bank         Tri-color LED bank
  908.  * @param        channel      Tri-color LED channel.
  909.  * @param        rampup       Ramp-up configuration.
  910.  *
  911.  * @return       This function returns PMIC_SUCCESS if successful.
  912.  */
  913. PMIC_STATUS pmic_tcled_fun_rampup(t_funlight_bank bank,
  914.                   t_funlight_channel channel, bool rampup);
  915. /*!
  916.  * This function gets Tri-color LED brightness Ramp Up function; Ramp time
  917.  * is fixed at 1 second.
  918.  *
  919.  * @param        bank         Tri-color LED bank
  920.  * @param        channel      Tri-color LED channel.
  921.  * @param        rampup       Ramp-up configuration.
  922.  *
  923.  * @return       This function returns PMIC_SUCCESS if successful.
  924.  */
  925. PMIC_STATUS pmic_tcled_get_fun_rampup(t_funlight_bank bank,
  926.                       t_funlight_channel channel,
  927.                       bool * rampup);
  928.  
  929. /*!
  930.  * This function initiates Tri-color LED brightness Ramp Down function; Ramp
  931.  * time is fixed at 1 second.
  932.  *
  933.  * @param        bank         Tri-color LED bank
  934.  * @param        channel      Tri-color LED channel.
  935.  * @param        rampdown     Ramp-down configuration.
  936.  *
  937.  * @return       This function returns PMIC_SUCCESS if successful.
  938.  */
  939. PMIC_STATUS pmic_tcled_fun_rampdown(t_funlight_bank bank,
  940.                     t_funlight_channel channel, bool rampdown);
  941. /*!
  942.  * This function initiates Tri-color LED brightness Ramp Down function; Ramp
  943.  * time is fixed at 1 second.
  944.  *
  945.  * @param        bank         Tri-color LED bank
  946.  * @param        channel      Tri-color LED channel.
  947.  * @param        rampdown     Ramp-down configuration.
  948.  *
  949.  * @return       This function returns PMIC_SUCCESS if successful.
  950.  */
  951. PMIC_STATUS pmic_tcled_get_fun_rampdown(t_funlight_bank bank,
  952.                     t_funlight_channel channel,
  953.                     bool * rampdown);
  954.  
  955. /*!
  956.  * This function enables a Tri-color channel triode mode.
  957.  *
  958.  * @param        bank         Tri-color LED bank
  959.  * @param        channel      Tri-color LED channel.
  960.  *
  961.  * @return       This function returns PMIC_SUCCESS if successful.
  962.  */
  963. PMIC_STATUS pmic_tcled_fun_triode_on(t_funlight_bank bank,
  964.                      t_funlight_channel channel);
  965.  
  966. /*!
  967.  * This function disables a Tri-color LED channel triode mode.
  968.  *
  969.  * @param        bank         Tri-color LED bank
  970.  * @param        channel      Tri-color LED channel.
  971.  *
  972.  * @return       This function returns PMIC_SUCCESS if successful.
  973.  */
  974. PMIC_STATUS pmic_tcled_fun_triode_off(t_funlight_bank bank,
  975.                       t_funlight_channel channel);
  976.  
  977. /*!
  978.  * This function enables Tri-color LED edge slowing.
  979.  *
  980.  * @return       This function returns PMIC_NOT_SUPPORTED.
  981.  */
  982. PMIC_STATUS pmic_tcled_enable_edge_slow(void);
  983.  
  984. /*!
  985.  * This function disables Tri-color LED edge slowing.
  986.  *
  987.  * @return       This function returns PMIC_NOT_SUPPORTED.
  988.  */
  989. PMIC_STATUS pmic_tcled_disable_edge_slow(void);
  990.  
  991. /*!
  992.  * This function enables Tri-color LED half current mode.
  993.  *
  994.  * @return       This function returns PMIC_NOT_SUPPORTED.
  995.  */
  996. PMIC_STATUS pmic_tcled_enable_half_current(void);
  997.  
  998. /*!
  999.  * This function disables Tri-color LED half current mode.
  1000.  *
  1001.  * @return       This function returns PMIC_NOT_SUPPORTED.
  1002.  */
  1003. PMIC_STATUS pmic_tcled_disable_half_current(void);
  1004.  
  1005. /*!
  1006.  * This function enables backlight or Tri-color LED audio modulation.
  1007.  *
  1008.  * @return       This function returns PMIC_NOT_SUPPORTED.
  1009.  */
  1010. PMIC_STATUS pmic_tcled_enable_audio_modulation(t_led_channel channel,
  1011.                            t_aud_path path,
  1012.                            t_aud_gain gain,
  1013.                            bool lpf_bypass);
  1014.  
  1015. /*!
  1016.  * This function disables backlight or Tri-color LED audio modulation.
  1017.  *
  1018.  * @return       This function returns PMIC_NOT_SUPPORTED.
  1019.  */
  1020. PMIC_STATUS pmic_tcled_disable_audio_modulation(void);
  1021. /*!
  1022.  * This function enables the boost mode.
  1023.  * Only on mc13783 2.0 or higher
  1024.  *
  1025.  * @param       en_dis   Enable or disable the boost mode
  1026.  *
  1027.  * @return      This function returns 0 if successful.
  1028.  */
  1029. PMIC_STATUS pmic_bklit_set_boost_mode(bool en_dis);
  1030.  
  1031. /*!
  1032.  * This function gets the boost mode.
  1033.  * Only on mc13783 2.0 or higher
  1034.  *
  1035.  * @param       en_dis   Enable or disable the boost mode
  1036.  *
  1037.  * @return      This function returns 0 if successful.
  1038.  */
  1039. PMIC_STATUS pmic_bklit_get_boost_mode(bool * en_dis);
  1040.  
  1041. /*!
  1042.  * This function sets boost mode configuration
  1043.  * Only on mc13783 2.0 or higher
  1044.  *
  1045.  * @param    abms      Define adaptive boost mode selection
  1046.  * @param    abr       Define adaptive boost reference
  1047.  *
  1048.  * @return       This function returns 0 if successful.
  1049.  */
  1050. PMIC_STATUS pmic_bklit_config_boost_mode(unsigned int abms, unsigned int abr);
  1051.  
  1052. /*!
  1053.  * This function gets boost mode configuration
  1054.  * Only on mc13783 2.0 or higher
  1055.  *
  1056.  * @param    abms      Define adaptive boost mode selection
  1057.  * @param    abr       Define adaptive boost reference
  1058.  *
  1059.  * @return       This function returns 0 if successful.
  1060.  */
  1061. PMIC_STATUS pmic_bklit_gets_boost_mode(unsigned int *abms, unsigned int *abr);
  1062.  
  1063. #if defined(CONFIG_MXC_PMIC_MC13892)
  1064.  
  1065. PMIC_STATUS mc13892_bklit_set_current(enum lit_channel channel,
  1066.                       unsigned char level);
  1067. PMIC_STATUS mc13892_bklit_get_current(enum lit_channel channel,
  1068.                       unsigned char *level);
  1069. PMIC_STATUS mc13892_bklit_set_dutycycle(enum lit_channel channel,
  1070.                     unsigned char dc);
  1071. PMIC_STATUS mc13892_bklit_get_dutycycle(enum lit_channel channel,
  1072.                     unsigned char *dc);
  1073. PMIC_STATUS mc13892_bklit_set_ramp(enum lit_channel channel, int flag);
  1074. PMIC_STATUS mc13892_bklit_get_ramp(enum lit_channel channel, int *flag);
  1075. PMIC_STATUS mc13892_bklit_set_blink_p(enum lit_channel channel, int period);
  1076. PMIC_STATUS mc13892_bklit_get_blink_p(enum lit_channel channel, int *period);
  1077.  
  1078. #endif
  1079.  
  1080. #endif                /* __KERNEL__ */
  1081.  
  1082. #endif                /* __ASM_ARCH_MXC_PMIC_LIGHT_H__ */
  1083.